/*
 * @Description:请求数据类公共属性类
 * @Version: 2.0
 * @Autor: wiz
 * @Date: 2022-12-12 10:30:53
 * @LastEditors: wiz
 * @LastEditTime: 2023-06-18 12:17:37
 */

import { CancelToken } from 'axios';
import { I_rule, T_rule } from './rule';
// 请求数据标准头
export class T_stdReq {
  // 功能名
  protected funName: string;

  // 表名
  protected tableName: string;
  // 规则

  protected rule: T_rule;
  // 当前语言

  protected lang: string;

  // 数据库类型
  protected dbType: string;

  // 查询取消
  protected cancel?: CancelToken;

  // axios.c   取消事件
  constructor() {
    this.rule = new T_rule();
  }

  public setFunName(p: string): T_stdReq {
    this.funName = p;
    return this;
  }

  public setTableName(p: string): T_stdReq {
    this.tableName = p;
    return this;
  }

  public getTableName(): string {
    return this.tableName;
  }

  public getFunName(): string {
    return this.funName;
  }

  public getDbType(): string {
    return this.dbType;
  }

  public setRule(p: I_rule): T_stdReq {
    this.rule = p;
    return this;
  }

  public setLang(p: string): T_stdReq {
    this.lang = p || 'en-US';
    return this;
  }

  public setDbType(p: string): T_stdReq {
    this.dbType = p;
    return this;
  }

  public setCancel(p: CancelToken): T_stdReq {
    this.cancel = p;
    return this;
  }
}
export interface I_stdReq extends T_stdReq {}
